﻿using System;
using System.Collections.Generic;
using System.Linq;
using NTTDATA.BEENChina.ResultCertification.Config;

namespace NTTDATA.BEENChina.ResultCertification.Checker.Date
{
    [Serializable]
    [VerfityAttribute(Id = "VerfityRq0214", Name = "上下午出现复数记载抽出", CategoryType = EnumCategoryType.日期, Model = true)]
    public class VerfityRq0214 : VerfityOneResult
    {
        //private string noonstring = "1.2";
        ///// <summary>
        /////         
        ///// </summary>
        //[Category("上下午标志"), Description("输入上下午标记")]
        //public string NoonString
        //{
        //    get { return noonstring; }
        //    set { noonstring = value; }
        //}

        public override bool CheckResult(List<List<string>> result, string entryCommon)
        {
            bool bresult = false;

            foreach (var rowResult in result)
            {
                foreach (var entryResult in rowResult)
                {
                    //得到上下午位置
                    List<string> arrayDateFormat = ChildImageObject.CategorySetting.DataFormat.Split(new char[] { '/' }).ToList();
                    int indexdd = arrayDateFormat.IndexOf("tt");

                    if (indexdd > -1)
                    {
                        //拆分结果
                        List<string> entry = entryResult.Split(new char[] { '/' }).ToList();
                        string tt = entry[indexdd];

                        bresult = !string.IsNullOrEmpty(tt) && tt.Contains(".");
                    }
                    if (bresult)
                        break;
                }
                if (bresult)
                    break;
            }

            if (bresult)
            {
                System.Console.WriteLine("VerfityRq0214");
            }

            return bresult;
        }
    }
}
